jQuery.fn.Flares = function() {	
	var args = arguments[0] || {};    
	var color = args.color;
	if(!color){color = 'blue';}
	var delay = args.delay;
	if(!delay){delay = 0;}
	
	var ft;		//timer
	var frequency = 100;	//delay to change flare
	
	
	
	jQuery('#lens_flare').append('<img src="images/lens_flare-left-'+color+'.png" id="lens_flare-left" />'+
	'<img src="images/lens_flare-right-'+color+'.png" id="lens_flare-right" />');
	jQuery('#lens_flare').css('opacity',0);
	
	function flare(){
		var rand_opacity_r = randomXToY(0.8,1,1);
		var rand_opacity_l = randomXToY(0.3,0.4,1);
		
		jQuery('#lens_flare-right').css({'opacity':rand_opacity_r});
		jQuery('#lens_flare-left').css({'opacity':rand_opacity_l});
		
		ft = setTimeout(flare,frequency);
	}
	
	if(args.stop === true){
		clearTimeout(ft);
		jQuery('#lens_flare').html('');
	}else{
		jQuery('#lens_flare').delay(delay).animate({'opacity':1},1000,function(){
			if(jQuery.browser.msie){
				if(jQuery.browser.version > 8){
					flare();
				}
			}else{
				flare();
			}
		});
	}


	
	//function to get random number
	function randomXToY(minVal,maxVal,floatVal)
	{
	  var randVal = minVal+(Math.random()*(maxVal-minVal));
	  return typeof floatVal=='undefined'?Math.round(randVal):randVal.toFixed(floatVal);
	}
	
	
	
};